 <?php

 if(!isset($_POST["type_id"])){
 form_head("report/order_list","") ?>
 
		 

	
	
		  <?php
			
		
		  
		  $rows =  $this->db->get("material_types")->result_array();
		  select_field("type_id","ชนิด",$rows,"type_name",0,0,"All",1,null,"",2);
		  	
		  ?>
			<?php 	text_field("date1","วันที่",array('date1'=>date('d/m/Y')),0,"date"); ?>
		   <?php text_field("date2","จนถึงวันที่",array("date2"=>date('d/m/Y')),0,"date"); ?>
	<?php form_footer("Filter");

 }
	?>
	
	<?php  if(isset($_POST["type_id"])){
  ?>
 <a target="_blank" href="<?php echo site_url("report/order_list_print/$type_id/$date1/$date2"); ?>"><img src="images/print.png">พิมพ์รายงาน</a>
 <table class="list">
        <tr>
       <th>เลขที่ใบสั่งซื้อ</th>
        <th style="width:40;">วันทีสั่่งซื้อ</th>
		<th>ชื่อ-นามสกุล ผู้สั่งซื้อ</th>
	<th>บริษัท</th>
	<th>งบประมาณ</th>
	
		<th>ใบสั่งซื้อ</th>
		
          </tr>
         <?php 
         $i = 1;
         foreach($rows as $row){ ?>
          
          <tr class="<?php if($i++%2){ echo "even";} ?>" >
          <td><span><?php echo $row['code']; ?></span></td> 
          <td><span><?php echo $row['create_date']; ?></span></td>
          <td><span><?php echo $row['firstname']."  ".$row["lastname"]; ?></span></td>
           <td><span><?php echo $row['company_name']; ?></span></td>
           <td><span><?php echo $row['budget_name']." ".$row["year"]; ?></span></td>
          <td><a target="_blank" href="<?php echo site_url("report/order/".$type_id."/".$row["order_id"]); ?>"><img src="images/print.png" /></a></td>
          
         
          </tr>
          <?php } ?>
        </tbody></table>
  
  <?php } ?>